
/*
 * Copyright 2002-2020 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2020原作者。
 *
 *根据Apache许可证2.0版（“许可证”）许可；
 *除非符合许可证的规定，否则您不得使用此文件。
 *您可以在以下网址获取许可证副本
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，否则软件
 *根据许可证分发是在“按原样”的基础上分发的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限的特定语言，请参阅许可证
 *许可证下的限制。
 */

package org.springframework.context.annotation;

import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * A single {@code condition} that must be {@linkplain #matches matched} in order
 * for a component to be registered.
 *
 * <p>Conditions are checked immediately before the bean-definition is due to be
 * registered and are free to veto registration based on any criteria that can
 * be determined at that point.
 *
 * <p>Conditions must follow the same restrictions as {@link BeanFactoryPostProcessor}
 * and take care to never interact with bean instances. For more fine-grained control
 * of conditions that interact with {@code @Configuration} beans consider implementing
 * the {@link ConfigurationCondition} interface.
 *
 * @author Phillip Webb
 * @since 4.0
 * @see ConfigurationCondition
 * @see Conditional
 * @see ConditionContext
 */
/**
 *一个｛@code条件｝，必须为｛@linkplain#，按顺序匹配｝
 *用于要注册的组件。
 *
 *＜p＞在bean定义到期之前立即检查条件
 *已注册，并可根据任何可能的标准自由否决注册
 *在那一点上确定。
 *
 *<p>条件必须遵循与｛@link BeanFactoryPostProcessor｝相同的限制
 *并注意永远不要与bean实例交互。用于更细粒度的控制
 *与｛@code@Configuration｝bean交互的条件考虑实现
 *｛@link ConfigurationCondition｝接口。
 *
 *@作者Phillip Webb
 *@自4.0起
 *@请参阅配置条件
 *@见条件
 *@参见ConditionContext
 */
@FunctionalInterface
public interface Condition {

	/**
	 * Determine if the condition matches.
	 * @param context the condition context
	 * @param metadata the metadata of the {@link org.springframework.core.type.AnnotationMetadata class}
	 * or {@link org.springframework.core.type.MethodMetadata method} being checked
	 * @return {@code true} if the condition matches and the component can be registered,
	 * or {@code false} to veto the annotated component's registration
	 */
	/**
	 *确定条件是否匹配。
	 *@param context条件上下文
	 *@param metadata｛@link org.springframework.core.type.AnnotationMetadata类的元数据｝
	 *或正在检查的｛@link org.springframework.core.type.MethodMetadata方法｝
	 *@return｛@code true｝如果条件匹配并且组件可以注册，
	 *或｛@code false｝否决带注释组件的注册
	 */
	boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata);

}
